<template>
  <div>
    <el-container>
      <el-header>
          <el-row>
            <el-col :span="2">祝您生活愉快</el-col>    
            <el-col :span="20">智慧家庭医生系统</el-col>     
            <el-col :span="2" >      
              <el-button type="danger" round size="mini" class="btnn" @click="out">退出登录</el-button>
            </el-col>  
          </el-row>
      </el-header>
      <el-container>
        <el-aside width="300px">
                <el-row class="tac">
                    <el-col :span="22">
                            <el-menu
                              default-active="2"
                              class="el-menu-vertical-demo"
                             >
                              <el-submenu index="1">
                                <template slot="title">
                                  <i class="el-icon-menu"></i>
                                  <span>导航</span>
                                </template>
                                <el-menu-item-group>      
                                  <el-menu-item index="1-1"><router-link to="/Pat_info">个人信息</router-link></el-menu-item>  
                                </el-menu-item-group>
                                <el-menu-item-group>
                                  <el-menu
                                    default-active="2"
                                    class="el-menu-vertical-demo">
                                    <el-submenu index="1">
                                      <template slot="title">
                                        <i class="el-icon-document"></i>
                                        <span>健康信息</span>
                                      </template>
                                      <el-menu-item-group>
                                         <template slot="title"><router-link to="/Pat_healthCheck">健康检测</router-link></template>
                                        
                                      </el-menu-item-group>
                                      <el-menu-item-group>
                                         <template slot="title"><router-link to="/Pat_healthRecord">健康档案</router-link></template>
                                        
                                      </el-menu-item-group>
                                    </el-submenu>

                                  </el-menu>
                                   
                                </el-menu-item-group>
                                
                                <el-menu-item-group>      
                                  <el-menu-item index="1-3"><router-link to="/Pat_family">家庭成员</router-link></el-menu-item>  
                                </el-menu-item-group>
                                <el-menu-item-group>      
                                  <el-menu-item index="1-4"><router-link to="/Pat_message">医生咨询</router-link></el-menu-item>  
                                </el-menu-item-group>
                                <el-menu-item-group>      
                                  <el-menu-item index="1-5"><router-link to="/Pat_myDoctor">签约医生</router-link></el-menu-item>  
                                </el-menu-item-group>
                                <el-menu-item-group>      
                                  <el-menu-item index="1-6"><router-link to="/Pat_myPackage">服务套餐</router-link></el-menu-item>  
                                </el-menu-item-group>
                                <el-menu-item-group>      
                                  <el-menu-item index="1-7"><router-link to="/Pat_sign">在线签约</router-link></el-menu-item>  
                                </el-menu-item-group>
                                <el-menu-item-group>      
                                  <el-menu-item index="1-8"><router-link to="/Pat_signRecord">签约记录</router-link></el-menu-item>  
                                </el-menu-item-group>
                                <el-menu-item-group>      
                                  <el-menu-item index="1-9"><router-link to="/Pat_appointment">预约服务</router-link></el-menu-item>  
                                </el-menu-item-group>
                                <el-menu-item-group>      
                                  <el-menu-item index="1-10"><router-link to="/Pat_appointmentRecord">预约记录</router-link></el-menu-item>  
                                </el-menu-item-group>
                              </el-submenu>
                            </el-menu>
                    </el-col>
                        
                </el-row>
            
        </el-aside>
        <el-main>
          <router-view></router-view>
        </el-main>
      </el-container>
    </el-container>
  </div>
</template>

<script>
export default {
  mounted(){
    this.selPatByUid();
    this.$router.push("/Pat_info");
  },
  methods: {
    selPatByUid(){
      let uid=JSON.parse(sessionStorage.getItem("u")).uid;
      this.$axios.post("patient-serv/patientinfo/selPatientByUid/"+uid).then((response) => {
          let info = JSON.stringify(response.data.data);
          sessionStorage.setItem("pat", info);
        });
    },
    out(){
      this.$axios.post("auth-serv/author/logout").then((response) => {
        let r=response.data;
        if(r.code==200){
          sessionStorage.removeItem("token");
          console.log("qqqqqqqqqqqqqq");
          this.$router.push("/User_login");
          return;
        }
        });
    },
  },
};
</script>

<style scoped>
.el-header, .el-footer {
    background-color: #B3C0D1;
    color: #333;
    text-align: center;
    line-height: 60px;
  }
  
  .el-aside {
    background-color: #D3DCE6;
    color: #333;
    text-align: center;
    line-height: 50px;
  }
  
  .el-main {
    background-color: #E9EEF3;
    color: #333;
    text-align: center;
    line-height: 80px;
    height: 700px;
  }
  
  body > .el-container {
    margin-bottom: 40px;
  }
  
  .el-container:nth-child(5) .el-aside,
  .el-container:nth-child(6) .el-aside {
    line-height: 260px;
  }
  
  .el-container:nth-child(7) .el-aside {
    line-height: 320px;
  }
  li{
    list-style-type: none;
  }
</style>